@namespace html "http://www.w3.org/1999/xhtml";

html|html, html|address, html|blockquote, html|body, html|dd, html|div,
html|dl, html|dt, html|fieldset, html|form, html|frame, html|frameset,
html|h1, html|h2, html|h3, html|h4, html|h5, html|h6, html|noframes,
html|ol, html|p, html|ul, html|center, html|dir, html|hr, html|menu, html|pre {
     display: block;
     unicode-bidi: embed;
}
html|li { 
    display: list-item;
}
html|head {
    display: none !important;
}
html|table {
    display: table;
}
html|tr {
    display: table-row;
}
html|thead {
    display: table-header-group;
}
html|tbody {
    display: table-row-group;
}
html|tfoot {
    display: table-footer-group;
}
html|col {
    display: table-column;
}
html|colgroup {
    display: table-column-group;
}
html|td, html|th {
    display: table-cell;
}
html|caption {
    display: table-caption;
    text-align: center;
}
html|th {
    font-weight: bolder;
    text-align: center;
}
html|script {
	display: none;
}
html|body {
    margin: 8px;
}
html|h1 {
    font-size: 2em;
	-adapt-margin-before: 0.67em;
	-adapt-margin-after: 0.67em;
	-adapt-margin-start: 0em;
	-adapt-margin-end: 0em;
}
html|h2 {
    font-size: 1.5em;
	-adapt-margin-before: 0.75em;
	-adapt-margin-after: 0.75em;
	-adapt-margin-start: 0em;
	-adapt-margin-end: 0em;
}
html|h3 {
    font-size: 1.17em;
	-adapt-margin-before: 0.83em;
	-adapt-margin-after: 0.83em;
	-adapt-margin-start: 0em;
	-adapt-margin-end: 0em;
}
html|h4, html|p, html|blockquote, html|ul, html|fieldset,
html|form, html|ol, html|dl, html|dir, html|menu, html|h5, html|h6 {
	-adapt-margin-before: 1em;
	-adapt-margin-after: 1em;
	-adapt-margin-start: 0em;
	-adapt-margin-end: 0em;
}
html|h5 {
    font-size: .83em;
}
html|h6 {
    font-size: .75em;
}
html|h1, html|h2, html|h3, html|h4, html|h5, html|h6, html|b, html|strong {
    font-weight: bolder;
}
html|blockquote {
    -adapt-margin-before: 0px;
    -adapt-margin-after: 0px;
    -adapt-margin-start: 40px;
    -adapt-margin-end: 40px;
}
html|i, html|cite, html|em, html|var, html|address {
    font-style: italic;
}
html|pre, html|tt, html|code, html|kbd, html|samp {
    font-family: monospace;
}
html|pre {
    white-space: pre;
}
html|button, html|textarea, html|input, html|select {
    display: inline-block;
}
html|big {
    font-size: 1.17em;
}
html|small, html|sub, html|sup {
    font-size: .83em;
}
html|sub {
    vertical-align: sub;
}
html|sup {
    vertical-align: super;
}
html|table { 
    border-spacing: 2px;
}
html|thead, html|tbody, html|tfoot {
    vertical-align: middle;
}
html|s, html|strike, html|del {
    text-decoration: line-through;
}
html|hr {
    border: 1px inset;
}
html|ol, html|ul, html|dir, html|menu, html|dd {
	margin: 0px;
    -adapt-margin-start: 40px;
}
html|ol { 
    list-style-type: decimal;
}
html|ol html|ul, html|ul html|ol, html|ul html|ul, html|ol html|ol {
    margin-top: 0;
    margin-bottom: 0;
}
html|u, html|ins {
    text-decoration: underline;
}
html|center {
    text-align: center;
}
html|q:before {
    content: open-quote;
}
html|q:after {
  content: close-quote;
}
html|audio, html|video {
  page-break-inside: avoid;
}
html|br:before {
  content: "\A";
  white-space: pre-line;
}

/*------------------ epub-specific ---------------------*/

@namespace epub "http://www.idpf.org/2007/ops";

html|a[epub|type="noteref"] {
	font-size: 0.75em;
	vertical-align: super;
	line-height: 0.01;
}

html|a[epub|type="noteref"]:href-epub-type(footnote) {
	-adapt-template: url(user-agent.xml#footnote);
	text-decoration: none;
}

html|aside[epub|type="footnote"] {
	display: none;
}

html|aside[epub|type="footnote"]:footnote-content {
	display: block;
	margin: 0.25em;
	font-size: 1.2em;
	line-height: 1.2;
}

epub|trigger {
	display: none;
}

epub|switch {
	display: inline;
}

epub|default {
	display: inline;
}

epub|case {
	display: none;
}

epub|case[required-namespace::supported] {
	display: inline;
}

epub|case[required-namespace::supported] ~ epub|case {
	display: none;
}

epub|case[required-namespace::supported] ~ epub|default {
	display: none;
}

/*--------------- ncx and toc ----------------------*/

@namespace ncx "http://www.daisy.org/z3986/2005/ncx/";

ncx|ncx {
	display: block;
    padding-top: 10px;
    padding-bottom: 10px;
}

ncx|navPoint, nav[epub|type=toc] li {
	display: block;
	margin: 0px;
	padding: 0px 0px 0px 1.25em;
    -adapt-behavior: toc-node;
}

nav[epub|type=toc] ol {
    -adapt-behavior: toc-container;
}

ncx|navLabel, nav[epub|type=toc] a {
	color: black;
	text-decoration: none;
}

ncx|content {
	display: none;
}

/*---------------- fb2 ---------------------*/

@namespace fb2 "http://www.gribuser.ru/xml/fictionbook/2.0";

fb2|FictionBook {
	display: block;
}

fb2|body {
    font-family: serif;
    margin: 8px;
    column-width: 25em;
}

fb2|a {
    line-height: 0.1;
    vertical-align: super;
    font-size: 0.7em;
}

fb2|sub {
    line-height: 0.1;
    font-size: 0.7em;
}

fb2|sup {
    line-height: 0.1;
    font-size: 0.7em;
}

fb2|table {
    display: table;
    font-size: 0.8em;
    font-family: sans-serif;
    margin: 0.5em;
    border-collapse: collapse;
    border: 1px solid black;
}

fb2|td {
    border: 1px solid black;
    padding: 0.3em;
}

fb2|th {
    font-weight: bold;
    text-align: center;
    border: 1px solid black;
    background-color: #CEE;
    padding: 0.3em;
}

fb2|code {
    font-family: monospace;
}

fb2|p {
    display: block;
    margin: 0px;
    text-indent: 1.5em;
    text-align: justify;
}

fb2|title fb2|p {
    margin: 0px 0px 0.5em 0px;
    text-indent: 0px;
    text-align: inherit;
}

fb2|title {
    font-size: 2.2em;
    font-weight: bold;
    page-break-inside: avoid;
    page-break-after: avoid;
    text-align: center;
    margin: 1em 0px 0.5em 0px;
    display: block;
}

fb2|section {
	display: block;
}

fb2|section fb2|title {
    font-size: 1.8em;
    text-align: center;
    margin: 1em 0px 0.5em 0px;
}

fb2|section fb2|section fb2|title {
    font-size: 1.5em;
    text-align: left;
    margin: 1em 0px 0.5em 1.5625em;
}

fb2|section fb2|section fb2|section fb2|title {
    font-size: 1.3em;
    text-align: left;
    margin: 1em 0px 0.5em 1.923em;
}

fb2|section fb2|section fb2|section fb2|section fb2|title {
    font-size: 1.2em;
    text-align: left;
    margin: 1em 0px 0.5em 2.083em;
}

fb2|section fb2|section fb2|section fb2|section fb2|section fb2|title {
    font-size: 1.1em;
    text-align: left;
    margin: 1em 0px 0.5em 2.272em;
}

fb2|section fb2|section fb2|section fb2|section fb2|section fb2|section fb2|title {
    text-align: left;
    margin: 1em 0px 0.5em 2.5em;
}

fb2|epigraph {
    text-align: left;
    font-style: italic;
    margin: 1em 1em 2em 30%;
    display: block;
}

fb2|image {
    text-align: center;
    padding: 3px;
}

fb2|image::inner {
	max-width: 95%;
}

fb2|image::after {
	display: block;
    content: attr(title);
}

fb2|v {
    text-indent: -1em;
    padding-left: 1em;
    margin: 0px;
    display: block;
}
fb2|poem {
    margin: 0.5em 0px 0.5em 2em;
    display: block;
}
fb2|date {
    margin: 0.5em 0px 0.5em 50%;
    font-style: italic;
    display: block;
}
fb2|stanza {
    margin: 0.5em 0px;
    page-break-inside: avoid;
    display: block;
}
fb2|empty-line {
    height: 1em;
    margin: 0px;
    display: block;
}
fb2|cite {
    margin: 0.5em 0px 0.5em 1em;
    font-size: 0.95em;
    display: block;
}
fb2|subtitle {
    text-indent: 0px;
    text-align: center;
    font-style: italic;
    font-weight: bold;
    margin: 0.5em 2em;
    page-break-inside: avoid;
    page-break-after: avoid;
    display: block;
}
fb2|annotation {
    margin: 1em 0px 1em 2em;
    text-indent: 0px;
    font-style: italic;
    display: block;
}
fb2|text-author {
    text-indent: 0px;
    margin: 0.2em 0px 0px 3em;
    display: block;
}
fb2|emphasis {
    font-style: italic;
}
fb2|strong {
    font-weight: bold;
}
fb2|strikethrough {
    text-decoration: line-through;
}
fb2|*.italic {
    font-style: italic;
}
fb2|*.bold {
    font-weight: bold;
}

fb2|binary, fb2|description, fb2|stylesheet {
	display: none;
}

fb2|a[type="note"] {
	font-size: 0.75em;
	vertical-align: super;
	line-height: 0.01;
	text-decoration: none;
	-adapt-template: url(user-agent.xml#footnote);	
}

fb2|body[name="notes"] {
	display: none;
}

fb2|body[name="notes"] fb2|title {
	display: inline;
	vertical-align: super;
	line-height: 0.01;	
	text-align: left;
	font-size: 0.75em;
	font-weight: bold;
	margin: 0px;
}

fb2|body[name="notes"] fb2|p {
	text-indent: 0px;
	display: inline;  /* for now */
}

fb2|body[name="notes"] fb2|p + fb2|p {
	display: block;
}

fb2|body[name="notes"] fb2|section {
	text-indent: 0px;
	line-height: 1.2;
	font-size: 1.2em;
}

/*--------------------- page masters ---------------------------*/

/*
html|body, fb2|body {
  -epub-hyphens: -epubx-expr(pref-hyphenate?"auto":"manual");
}

@-adapt-footnote-area {
  -adapt-margin-before: 0.5em;
  -adapt-margin-after: 0.5em;
}

@-adapt-footnote-area ::before {
  display: block;
  -adapt-border-before-width: 1px;
  -adapt-border-before-style: solid;
  -adapt-border-before-color: black;
  -adapt-margin-after: 0.4em;
  -adapt-margin-start: 0;
  -adapt-margin-end: 60%;
}
*/

/* default page master */
@-epubx-page-master builtin :background-host {
  @-epubx-partition :layout-host {
    -epubx-flow-from: body;
    top: -epubx-expr(header.margin-bottom-edge);
    bottom: -epubx-expr(page-height - footer.margin-top-edge);
    left: 0px;
    right: 0px;
    column-width: 25em;
  }
  @-epubx-partition footer :oeb-page-foot {
    -epub-writing-mode: horizontal-tb;
    -epubx-flow-from: oeb-page-foot;
    bottom: 0px;
    left: 0px;
    right: 0px;
  }
  @-epubx-partition header :oeb-page-head {
    -epub-writing-mode: horizontal-tb;
    -epubx-flow-from: oeb-page-head;
    top: 0px;
    left: 0px;
    right: 0px;
  }
}